package com.ruoyi.partybuilding.domain;

import com.easy.query.core.enums.RelationTypeEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.partybuilding.common.EQuery.CU2Entity;
import com.ruoyi.partybuilding.controller.ConstData;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import lombok.Data;
import com.easy.query.core.annotation.*;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;

/**
 * 发布任务;
 * @author : He-LiangLiang@Outlook.com
 * @date : 2025-3-4
 */
@ApiModel(value = "发布任务",description = "")
@Table("pb_release_task")
@Data
public class ReleaseTask extends CU2Entity.LongId implements Serializable,Cloneable{

    /** 阶段：0草稿，1申请中(寻榜)、20审批通过(定榜)、21审批驳回、30发榜、40揭榜、50攻榜、60完成、61评榜、62奖榜、63用榜
     *
     */
    @ApiModel(description = ConstData.ReleaseTask_StageVals)
    public static class StageVal {
        public final static int 草稿 = 0;
        public final static int 申请中 = 1;//(寻榜)
        public final static int 审批通过 = 20;//(定榜)、
        public final static int 审批驳回 = 21;
        public final static int 发榜 = 30;
        public final static int 揭榜 = 40;
        public final static int 攻榜 = 50;
        public final static int 完成 = 60;
        public final static int 评榜 = 61;
        public final static int 奖榜 = 62;
        public final static int 用榜 = 63;
    }

    /** 标题 */
    @EasyWhereCondition
    private String title;
    /** 内容 */
    @ApiModelProperty(value = "内容",notes = "")
    private String content ;
    /** 阶段：0草稿，1申请中(寻榜)、20审批通过(定榜)、21审批驳回、30发榜、40揭榜、50攻榜、60完成、61评榜、62奖榜、63用榜 */
    @EasyWhereCondition(type = EasyWhereCondition.Condition.EQUAL)
    @ApiModelProperty(value = ConstData.ReleaseTask_StageVals,notes = ConstData.ReleaseTask_StageVals)
    private Integer stage ;

    @EasyWhereCondition
    @ApiModelProperty("阶段扩展记录：1评榜、2奖榜、3用榜；例如：用榜3，评榜和用榜13,三个全都有123")
    String stageExt;
    /** 审批记录 */
    @ApiModelProperty(value = "审批记录",notes = "")
    private String record ;
    /** 发起人 */
    @ApiModelProperty(value = "发起人",notes = "")
    private String originator ;
    /** 审批人 */
    @ApiModelProperty(value = "审批人",notes = "")
    private String approve ;
    /** 揭榜人 */
    @ApiModelProperty(value = "揭榜人",notes = "")
    private String implementer ;
    @EasyWhereCondition(type = EasyWhereCondition.Condition.EQUAL)
    @ApiModelProperty(value = "揭榜人id",notes = "")
    private Long implementerId ;
    /** 评榜人 */
    @ApiModelProperty(value = "评榜人",notes = "")
    private String reviewers ;
    /** 评分 */
    @ApiModelProperty(value = "评分",notes = "")
    private Float rating ;

    @ApiModelProperty("附件")
    String files;

    @Navigate(value = RelationTypeEnum.OneToMany,targetProperty = "releaseTaskId", selfProperty = "id")
     List<ReleaseDetails> childs;

    @ApiModelProperty(value = "创建时间",notes = "")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @EasyWhereCondition(type = EasyWhereCondition.Condition.RANGE_LEFT_CLOSED)
    private Date createTime ;
    @ApiModelProperty(value = "创建时间2，查询使用",notes = "")
    @EasyWhereCondition(type = EasyWhereCondition.Condition.RANGE_RIGHT_CLOSED,propName = "createTime")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ColumnIgnore
    Date createTime2;

    @ApiModelProperty(value = "多stage查询，查询使用,如：0,1,21;与stage条件查询互斥请二选一",notes = "")
    @ColumnIgnore
    @EasyWhereCondition(type = EasyWhereCondition.Condition.IN,propName = "stage")
    private List<Integer> stageArr=new ArrayList<>();
}
